package org.sith.taskrunner.gwt.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;


public class AdminButtonsWidget extends Composite implements IAdminButtonsView{

    @Override
    public Widget getViewWidget() {
        return this;
    }

    interface AdminButtonsUiBinder extends UiBinder<VerticalPanel, AdminButtonsWidget> {
    }


    private IAdminButtonsView.Presenter presenter;

    private static AdminButtonsUiBinder ourUiBinder = GWT.create(AdminButtonsUiBinder.class);
    @UiField
    Button manageUsersButton;

    public AdminButtonsWidget() {
        initWidget(ourUiBinder.createAndBindUi(this));
    }

    @UiHandler("manageUsersButton")
    public void handleClick(ClickEvent event) {
        presenter.showUsersTable();
    }

    public void setPresenter(IAdminButtonsView.Presenter presenter) {
        this.presenter = presenter;
    }

}